package com.muyu.system.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.danmo.domain.DanmoAddresses;
import com.muyu.common.core.enums.OrderStatus;
import com.muyu.common.core.enums.PayMethod;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 用户订单对象 danmo_market_order
 *
 * @author yangle
 * @date 2024-09-08
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class DanmoMarketOrder extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 订单ID
     */
    private Long id;

    /**
     * 用户ID
     */
    @Excel(name = "用户ID")
    private Long userId;

    /**
     * 商品数量
     */
    @Excel(name = "商品数量")
    private Long quantity;

    /**
     * 快递
     */
    @Excel(name = "快递")
    private String posExpress;

    /**
     * 快递单号
     */
    @Excel(name = "快递单号")
    private Long expressDeliveryNumber;

    /**
     * 订单状态(1 待付款、2 待发货、3 已发货、4 已完成、5 已取消)
     */
    @Excel(name = "订单状态(1 待付款、2 待发货、3 已发货、4 已完成、5 已取消)")
    private OrderStatus orderStatus;

    /**
     * 商品ID
     */
    @Excel(name = "商品ID")
    private Long productId;

    /**
     * 书画市场商品id
     */
    @Excel(name = "书画市场商品id")
    private Long marketProducts;

    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date orderTime;

    /**
     * 发货时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date deliveryTime;

    /**
     * 付款时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date paymentTime;

    /**
     * 成交时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date transactionTime;

    /**
     * 上架时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date shelfTime;

    /**
     * 订单总金额
     */
    @Excel(name = "订单总金额")
    private BigDecimal totalAmount;

    @Excel(name = "订单地址")
    private Long addressesId;

    /**
     * 支付方式
     */
    @Excel(name = "支付方硕")
    private PayMethod paymentMethod;

    /**
     * 订单来源
     */
    @Excel(name = "订单来源")
    private Long orderSource;

    /**
     * 商品信息
     */
    private DanmoMarketProducts danmoMarketProducts;

    /**
     * 订单地址
     */
    private DanmoAddresses danmoAddresses;

    /**
     * 是否来自购物车
     */
    private String isShoppingCart;

    /**
     * 商品单价
     */
    private BigDecimal unitPrice;

    /**
     * 邮费总和
     */
    private BigDecimal totalPostage;

    private String orderSn;
    /**
     * 支付系统订单好
     */
    private String payOrderNo;

    @TableField(exist = false)
    private Integer pageNum = 1;
    @TableField(exist = false)
    private Integer pageSize = 10;


    /** 收货人姓名 */
    private String receiverName;

    /** 收货人电话 */
    private String receiverPhone;

    /** 省份/直辖市 */
    private String receiverProvince;

    /** 城市 */
    private String receiverCity;

    /** 区 */
    private String receiverRegion;

    /** 详细地址 */
    private String receiverDetailAddress;
    /**
     * 退款单号
     */
    private String refundOrderSn;
    /**
     * 支付系统的退款时间
     */
    private String payRefundOrderNo;
    /**
     * 退款时间
     */
    private LocalDateTime refundTime;


    /**
     * 卖家用户id
     */
    private Long sellerUserId;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("userId", getUserId())
                .append("quantity", getQuantity())
                .append("orderStatus", getOrderStatus())
                .append("productId", getProductId())
                .append("marketProducts", getMarketProducts())
                .append("posExpress", getPosExpress())
                .append("expressDeliveryNumber", getExpressDeliveryNumber())
                .append("orderTime", getOrderTime())
                .append("deliveryTime", getDeliveryTime())
                .append("paymentTime", getPaymentTime())
                .append("transactionTime", getTransactionTime())
                .append("shelfTime", getShelfTime())
                .append("totalAmount", getTotalAmount())
                .append("addressesId", getAddressesId())
                .append("paymentMethod", getPaymentMethod())
                .append("orderSource", getOrderSource())
                .append("danmoMarketProducts", getDanmoMarketProducts())
                .append("danmoAddresses", getDanmoAddresses())
                .append("isShoppingCart", getIsShoppingCart())
                .append("unitPrice", getUnitPrice())
                .append("totalPostage", getTotalPostage())
                .toString();

    }
}
